cc.Class({
    extends: cc.Component,

    properties: {
        stateFX: cc.SpriteFrame
    },

    // use this for initialization
    onLoad() {
        this.num = 0;
    },

    init(game) {
        this.game = game;
        this.num = 0;
        // this.getComponent(cc.Sprite).spriteFrame = this.stateFX[0];
        // this.frame = this.stateFX[0];
    },

    // 碰撞开始
    onCollisionEnter(other, self) {
        this.num += 1;
        this.getComponent(cc.Sprite).spriteFrame = this.stateFX[this.num];
        if (this.num === 2) {
            this.node.removeFromParent();
            this.game.spawnTank();
            cc.pool.putInPool(this);
            this.getComponent(cc.Sprite).spriteFrame = this.stateFX[0];
        }
    },

    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {
    //     this.node.x -= 1;
    // },
});
